﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
using System.Xml.Linq;
using System.Drawing;
using System.Windows.Forms;

namespace BackOffice.Context.UltiPro
{
    public static class Helpers
    {   
        public static string GetConfigValue(string key)
        {
            AppSettingsReader reader = new AppSettingsReader();
            return reader.GetValue(key, typeof(string)).ToString();
        }

        public static Point ScaledPosition(int xPos, int yPos)
        {
            return new Point(ScaledXPosition(xPos), ScaledYPosition(yPos));
        }

        public static int ScaledXPosition(int xPos)
        {
            int xRes = Screen.PrimaryScreen.Bounds.Width;
            double xFactor = xRes / 1680.0; // WR Recommended X Resolution: 1024

            return (int)Math.Round(xPos * xFactor);
        }

        public static int ScaledYPosition(int yPos)
        {
            int yRes = Screen.PrimaryScreen.Bounds.Height;
            double yFactor = yRes / 1050.0; // WR Recommended Y Resolution: 768

            return (int)Math.Round(yPos * yFactor);
        }
    }
}
